﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="用JS中DOM创建对象.aspx.cs" Inherits="Dom操作_用JS中DOM创建对象" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>用JS中DOM创建对象</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <iframe  id="dss" name="dss" src="http://www.soso.com/q?w=ff%20ifarme&ch=t.u" runat=server></iframe>
    </div>

<script language="javascript" type="text/javascript">
/* 要创建的文档结构如下
<cds>
 <book>sdfd</book>
  <cdd>
    <sdf>1</sdf>
  </cdd>
</cds>
*/
var newdom = "cds";
var cds =  document.createElement("cds");
var text = document.createTextNode("sdfd");
var book = document.createElement("book ");   
var cdd = document.createElement("cdd");
var sdf = document.createElement("sdf");
//开始组成文档结构
book.appendChild(text);
text = document.createTextNode("1");
sdf.appendChild(text);
cdd.appendChild(sdf);
cds.appendChild(book);
cds.appendChild(cdd);
alert(cds.innerHTML);


/*
    book.appendChild(text);
    text = document.createTextNode("1");
    sdf.appChild(text);
    cdd.appendChild(sdf);
    cds.appendChild(book);
    cds.appendChild(cdd);*/
    


</script>
    <asp:DataPager ID="DataPager1" runat="server">
        <Fields>
            <asp:nextpreviouspagerfield ButtonType="Button" FirstPageText="First" 
                LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" 
                ShowFirstPageButton="True" ShowNextPageButton="False" 
                ShowPreviousPageButton="False" />
            <asp:numericpagerfield NextPageText="..." PreviousPageText="..." />
            <asp:nextpreviouspagerfield ButtonType="Button" FirstPageText="First" 
                LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" 
                ShowLastPageButton="True" ShowNextPageButton="False" 
                ShowPreviousPageButton="False" />
        </Fields>
    </asp:DataPager>
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="ClaId" 
        DataSourceID="SqlDataSource1">
        <AlternatingItemTemplate>
            <li style="background-color: #FFF8DC;">ClaId:
                <asp:Label ID="ClaIdLabel" runat="server" Text='<%# Eval("ClaId") %>' />
                <br />
                ClaName:
                <asp:Label ID="ClaNameLabel" runat="server" Text='<%# Eval("ClaName") %>' />
                <br />
                ClaParId:
                <asp:Label ID="ClaParIdLabel" runat="server" Text='<%# Eval("ClaParId") %>' />
                <br />
                ClaNavIdList:
                <asp:Label ID="ClaNavIdListLabel" runat="server" 
                    Text='<%# Eval("ClaNavIdList") %>' />
                <br />
                <asp:CheckBox ID="ClaDisCheckBox" runat="server" 
                    Checked='<%# Eval("ClaDis") %>' Enabled="false" Text="ClaDis" />
                <br />
                iCount:
                <asp:Label ID="iCountLabel" runat="server" Text='<%# Eval("iCount") %>' />
                <br />
                Depth:
                <asp:Label ID="DepthLabel" runat="server" Text='<%# Eval("Depth") %>' />
                <br />
                SpellName:
                <asp:Label ID="SpellNameLabel" runat="server" Text='<%# Eval("SpellName") %>' />
                <br />
                TemplateStyle:
                <asp:Label ID="TemplateStyleLabel" runat="server" 
                    Text='<%# Eval("TemplateStyle") %>' />
                <br />
                ClaNavIdList1:
                <asp:Label ID="ClaNavIdList1Label" runat="server" 
                    Text='<%# Eval("ClaNavIdList1") %>' />
                <br />
                ClaSort:
                <asp:Label ID="ClaSortLabel" runat="server" Text='<%# Eval("ClaSort") %>' />
                <br />
            </li>
        </AlternatingItemTemplate>
        <LayoutTemplate>
            <ul id="itemContainer" runat="server" 
                style="font-family: Verdana, Arial, Helvetica, sans-serif;">
            </ul>
            <div style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
            </div>
        </LayoutTemplate>
        <ItemTemplate>
            <li style="background-color: #DCDCDC;color: #000000;">ClaId:
                <asp:Label ID="ClaIdLabel" runat="server" Text='<%# Eval("ClaId") %>' />
                <br />
                ClaName:
                <asp:Label ID="ClaNameLabel" runat="server" Text='<%# Eval("ClaName") %>' />
                <br />
                ClaParId:
                <asp:Label ID="ClaParIdLabel" runat="server" Text='<%# Eval("ClaParId") %>' />
                <br />
                ClaNavIdList:
                <asp:Label ID="ClaNavIdListLabel" runat="server" 
                    Text='<%# Eval("ClaNavIdList") %>' />
                <br />
                <asp:CheckBox ID="ClaDisCheckBox" runat="server" 
                    Checked='<%# Eval("ClaDis") %>' Enabled="false" Text="ClaDis" />
                <br />
                iCount:
                <asp:Label ID="iCountLabel" runat="server" Text='<%# Eval("iCount") %>' />
                <br />
                Depth:
                <asp:Label ID="DepthLabel" runat="server" Text='<%# Eval("Depth") %>' />
                <br />
                SpellName:
                <asp:Label ID="SpellNameLabel" runat="server" Text='<%# Eval("SpellName") %>' />
                <br />
                TemplateStyle:
                <asp:Label ID="TemplateStyleLabel" runat="server" 
                    Text='<%# Eval("TemplateStyle") %>' />
                <br />
                ClaNavIdList1:
                <asp:Label ID="ClaNavIdList1Label" runat="server" 
                    Text='<%# Eval("ClaNavIdList1") %>' />
                <br />
                ClaSort:
                <asp:Label ID="ClaSortLabel" runat="server" Text='<%# Eval("ClaSort") %>' />
                <br />
            </li>
        </ItemTemplate>
        <InsertItemTemplate>
            <li style="">ClaId:
                <asp:TextBox ID="ClaIdTextBox" runat="server" Text='<%# Bind("ClaId") %>' />
                <br />
                ClaName:
                <asp:TextBox ID="ClaNameTextBox" runat="server" Text='<%# Bind("ClaName") %>' />
                <br />
                ClaParId:
                <asp:TextBox ID="ClaParIdTextBox" runat="server" 
                    Text='<%# Bind("ClaParId") %>' />
                <br />
                ClaNavIdList:
                <asp:TextBox ID="ClaNavIdListTextBox" runat="server" 
                    Text='<%# Bind("ClaNavIdList") %>' />
                <br />
                <asp:CheckBox ID="ClaDisCheckBox" runat="server" 
                    Checked='<%# Bind("ClaDis") %>' Text="ClaDis" />
                <br />
                iCount:
                <asp:TextBox ID="iCountTextBox" runat="server" Text='<%# Bind("iCount") %>' />
                <br />
                Depth:
                <asp:TextBox ID="DepthTextBox" runat="server" Text='<%# Bind("Depth") %>' />
                <br />
                SpellName:
                <asp:TextBox ID="SpellNameTextBox" runat="server" 
                    Text='<%# Bind("SpellName") %>' />
                <br />
                TemplateStyle:
                <asp:TextBox ID="TemplateStyleTextBox" runat="server" 
                    Text='<%# Bind("TemplateStyle") %>' />
                <br />
                ClaNavIdList1:
                <asp:TextBox ID="ClaNavIdList1TextBox" runat="server" 
                    Text='<%# Bind("ClaNavIdList1") %>' />
                <br />
                ClaSort:
                <asp:TextBox ID="ClaSortTextBox" runat="server" Text='<%# Bind("ClaSort") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
            </li>
        </InsertItemTemplate>
        <SelectedItemTemplate>
            <li style="background-color: #008A8C;font-weight: bold;color: #FFFFFF;">ClaId:
                <asp:Label ID="ClaIdLabel" runat="server" Text='<%# Eval("ClaId") %>' />
                <br />
                ClaName:
                <asp:Label ID="ClaNameLabel" runat="server" Text='<%# Eval("ClaName") %>' />
                <br />
                ClaParId:
                <asp:Label ID="ClaParIdLabel" runat="server" Text='<%# Eval("ClaParId") %>' />
                <br />
                ClaNavIdList:
                <asp:Label ID="ClaNavIdListLabel" runat="server" 
                    Text='<%# Eval("ClaNavIdList") %>' />
                <br />
                <asp:CheckBox ID="ClaDisCheckBox" runat="server" 
                    Checked='<%# Eval("ClaDis") %>' Enabled="false" Text="ClaDis" />
                <br />
                iCount:
                <asp:Label ID="iCountLabel" runat="server" Text='<%# Eval("iCount") %>' />
                <br />
                Depth:
                <asp:Label ID="DepthLabel" runat="server" Text='<%# Eval("Depth") %>' />
                <br />
                SpellName:
                <asp:Label ID="SpellNameLabel" runat="server" Text='<%# Eval("SpellName") %>' />
                <br />
                TemplateStyle:
                <asp:Label ID="TemplateStyleLabel" runat="server" 
                    Text='<%# Eval("TemplateStyle") %>' />
                <br />
                ClaNavIdList1:
                <asp:Label ID="ClaNavIdList1Label" runat="server" 
                    Text='<%# Eval("ClaNavIdList1") %>' />
                <br />
                ClaSort:
                <asp:Label ID="ClaSortLabel" runat="server" Text='<%# Eval("ClaSort") %>' />
                <br />
            </li>
        </SelectedItemTemplate>
        <EmptyDataTemplate>
            No data was returned.
        </EmptyDataTemplate>
        <EditItemTemplate>
            <li style="background-color: #008A8C;color: #FFFFFF;">ClaId:
                <asp:Label ID="ClaIdLabel1" runat="server" Text='<%# Eval("ClaId") %>' />
                <br />
                ClaName:
                <asp:TextBox ID="ClaNameTextBox" runat="server" Text='<%# Bind("ClaName") %>' />
                <br />
                ClaParId:
                <asp:TextBox ID="ClaParIdTextBox" runat="server" 
                    Text='<%# Bind("ClaParId") %>' />
                <br />
                ClaNavIdList:
                <asp:TextBox ID="ClaNavIdListTextBox" runat="server" 
                    Text='<%# Bind("ClaNavIdList") %>' />
                <br />
                <asp:CheckBox ID="ClaDisCheckBox" runat="server" 
                    Checked='<%# Bind("ClaDis") %>' Text="ClaDis" />
                <br />
                iCount:
                <asp:TextBox ID="iCountTextBox" runat="server" Text='<%# Bind("iCount") %>' />
                <br />
                Depth:
                <asp:TextBox ID="DepthTextBox" runat="server" Text='<%# Bind("Depth") %>' />
                <br />
                SpellName:
                <asp:TextBox ID="SpellNameTextBox" runat="server" 
                    Text='<%# Bind("SpellName") %>' />
                <br />
                TemplateStyle:
                <asp:TextBox ID="TemplateStyleTextBox" runat="server" 
                    Text='<%# Bind("TemplateStyle") %>' />
                <br />
                ClaNavIdList1:
                <asp:TextBox ID="ClaNavIdList1TextBox" runat="server" 
                    Text='<%# Bind("ClaNavIdList1") %>' />
                <br />
                ClaSort:
                <asp:TextBox ID="ClaSortTextBox" runat="server" Text='<%# Bind("ClaSort") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
            </li>
        </EditItemTemplate>
        <itemseparatortemplate>
            <br />
        </itemseparatortemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:SqlConn %>" 
        DeleteCommand="DELETE FROM [ArticleClass] WHERE [ClaId] = @original_ClaId AND [ClaName] = @original_ClaName AND [ClaParId] = @original_ClaParId AND [ClaNavIdList] = @original_ClaNavIdList AND [ClaDis] = @original_ClaDis AND [iCount] = @original_iCount AND [Depth] = @original_Depth AND [SpellName] = @original_SpellName AND [TemplateStyle] = @original_TemplateStyle AND [ClaNavIdList1] = @original_ClaNavIdList1 AND [ClaSort] = @original_ClaSort" 
        InsertCommand="INSERT INTO [ArticleClass] ([ClaName], [ClaParId], [ClaNavIdList], [ClaDis], [iCount], [Depth], [SpellName], [TemplateStyle], [ClaNavIdList1], [ClaSort]) VALUES (@ClaName, @ClaParId, @ClaNavIdList, @ClaDis, @iCount, @Depth, @SpellName, @TemplateStyle, @ClaNavIdList1, @ClaSort)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [ArticleClass]" 
        UpdateCommand="UPDATE [ArticleClass] SET [ClaName] = @ClaName, [ClaParId] = @ClaParId, [ClaNavIdList] = @ClaNavIdList, [ClaDis] = @ClaDis, [iCount] = @iCount, [Depth] = @Depth, [SpellName] = @SpellName, [TemplateStyle] = @TemplateStyle, [ClaNavIdList1] = @ClaNavIdList1, [ClaSort] = @ClaSort WHERE [ClaId] = @original_ClaId AND [ClaName] = @original_ClaName AND [ClaParId] = @original_ClaParId AND [ClaNavIdList] = @original_ClaNavIdList AND [ClaDis] = @original_ClaDis AND [iCount] = @original_iCount AND [Depth] = @original_Depth AND [SpellName] = @original_SpellName AND [TemplateStyle] = @original_TemplateStyle AND [ClaNavIdList1] = @original_ClaNavIdList1 AND [ClaSort] = @original_ClaSort">
        <DeleteParameters>
            <asp:parameter Name="original_ClaId" Type="Int16" />
            <asp:parameter Name="original_ClaName" Type="String" />
            <asp:parameter Name="original_ClaParId" Type="Int16" />
            <asp:parameter Name="original_ClaNavIdList" Type="String" />
            <asp:parameter Name="original_ClaDis" Type="Boolean" />
            <asp:parameter Name="original_iCount" Type="Int32" />
            <asp:parameter Name="original_Depth" Type="Single" />
            <asp:parameter Name="original_SpellName" Type="String" />
            <asp:parameter Name="original_TemplateStyle" Type="String" />
            <asp:parameter Name="original_ClaNavIdList1" Type="String" />
            <asp:parameter Name="original_ClaSort" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:parameter Name="ClaName" Type="String" />
            <asp:parameter Name="ClaParId" Type="Int16" />
            <asp:parameter Name="ClaNavIdList" Type="String" />
            <asp:parameter Name="ClaDis" Type="Boolean" />
            <asp:parameter Name="iCount" Type="Int32" />
            <asp:parameter Name="Depth" Type="Single" />
            <asp:parameter Name="SpellName" Type="String" />
            <asp:parameter Name="TemplateStyle" Type="String" />
            <asp:parameter Name="ClaNavIdList1" Type="String" />
            <asp:parameter Name="ClaSort" Type="Int32" />
            <asp:parameter Name="original_ClaId" Type="Int16" />
            <asp:parameter Name="original_ClaName" Type="String" />
            <asp:parameter Name="original_ClaParId" Type="Int16" />
            <asp:parameter Name="original_ClaNavIdList" Type="String" />
            <asp:parameter Name="original_ClaDis" Type="Boolean" />
            <asp:parameter Name="original_iCount" Type="Int32" />
            <asp:parameter Name="original_Depth" Type="Single" />
            <asp:parameter Name="original_SpellName" Type="String" />
            <asp:parameter Name="original_TemplateStyle" Type="String" />
            <asp:parameter Name="original_ClaNavIdList1" Type="String" />
            <asp:parameter Name="original_ClaSort" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:parameter Name="ClaName" Type="String" />
            <asp:parameter Name="ClaParId" Type="Int16" />
            <asp:parameter Name="ClaNavIdList" Type="String" />
            <asp:parameter Name="ClaDis" Type="Boolean" />
            <asp:parameter Name="iCount" Type="Int32" />
            <asp:parameter Name="Depth" Type="Single" />
            <asp:parameter Name="SpellName" Type="String" />
            <asp:parameter Name="TemplateStyle" Type="String" />
            <asp:parameter Name="ClaNavIdList1" Type="String" />
            <asp:parameter Name="ClaSort" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>

    </form>
</body>

</html>
